<script>
import axios from "axios";

export default {
  name: 'MemberCenter',
  data() {
    return {
      info: this.$route.params.member,
      token: '',
      navigation:[]
    }
  },
  async created() {
    await axios.post("http://localhost:5050/GetToken", this.info)
        .then(response =>
        {
          this.token = response.data.total
          if(this.info.identity === "President"){
            this.navigation = [
              {
                name : 'GetAllMember',
                path : '/'
              },
              {
                name : 'Update',
                path : '/'
              },
              {
                name : 'Delete',
                path : '/'
              }
            ]
          }else{
            this.navigation = [
              {
                name : 'Update',
                path : '/'
              },
              {
                name : 'Delete',
                path : '/'
              }
            ]
          }
        })
        .catch(error => {
          console.log(error.message)
        });
  },
  async update(){

  },
}
</script>

<template>
<el-container>
  <el-aside>
    <nav class="navbar">
      <ul class="nav-menu" >
        <li v-bind:key="a" v-for="a in navigation">
          <router-link to={{a.path}}>{{a.name}}</router-link>
        </li>
      </ul>
    </nav>
  </el-aside>
  <el-main>
    <router-view class="contanier" />
  </el-main>
</el-container>
</template>

<style scoped>
.contanier {
  min-height: 100vh;
}
</style>